package com.tis.std;

import java.util.HashMap;
import java.util.Map;

import org.apache.log4j.Logger;

import promis.utility.CommonService;

public class commons {
	
	private static final Logger log = Logger.getLogger(commons.class);
	
	private String company;
	private String project;
	private String buildingPhase;
	private String zoneCode;
	private String unitNumber;
	private String sapPlantCode;
	private String matritalCode;
	private String customerCode;
	private String status;
	private String receipt_status;
	private String bs_cs_status;
	private String action;
	private String syncIsstaging;
	private String documentNo;
	private String contractNo;
	private String BookingOrContarctNo;
	private String ReceipteddocumentNo;
	private String CN_DocumentNo;
	private String contractRefNo;
	private String processAction;
	private String processActionBy;	
	/**
	 * refType such as CT,VO
	 */	
	private String refType;
	
	protected void CleanValue(){
		setCompany(null);
		setProject(null);
		setBuildingPhase(null);
		setZoneCode(null);
		setUnitNumber(null);
		setSapPlantCode(null);
		setMatritalCode(null);
		setCustomerCode(null);
		setStatus(null);
		setReceipt_status(null);
		setBs_cs_status(null);
		setAction(null);
		setSyncIsstaging(null);
		setDocumentNo(null);
		setContractNo(null);
		setBookingOrContarctNo(null);
		setReceipteddocumentNo(null);
		setCN_DocumentNo(null);
		setContractRefNo(null);
		setProcessAction(null);
		setProcessActionBy(null);	
		setRefType(null);
	}
	
	/**
	 * @return the company
	 */
	protected String getCompany() {
		return company;
	}

	/**
	 * @param company the company to set
	 */
	protected void setCompany(String company) {
		this.company = company;
	}

	/**
	 * @return the project
	 */
	protected String getProject() {
		return project;
	}



	/**
	 * @param project the project to set
	 */
	protected void setProject(String project) {
		this.project = project;
	}



	/**
	 * @return the buildingPhase
	 */
	protected String getBuildingPhase() {
		return buildingPhase;
	}



	/**
	 * @param buildingPhase the buildingPhase to set
	 */
	protected void setBuildingPhase(String buildingPhase) {
		this.buildingPhase = buildingPhase;
	}



	/**
	 * @return the zoneCode
	 */
	protected String getZoneCode() {
		return zoneCode;
	}



	/**
	 * @param zoneCode the zoneCode to set
	 */
	protected void setZoneCode(String zoneCode) {
		this.zoneCode = zoneCode;
	}



	/**
	 * @return the unitNumber
	 */
	protected String getUnitNumber() {
		return unitNumber;
	}



	/**
	 * @param unitNumber the unitNumber to set
	 */
	protected void setUnitNumber(String unitNumber) {
		this.unitNumber = unitNumber;
	}



	/**
	 * @return the sapPlantCode
	 */
	protected String getSapPlantCode() {
		return sapPlantCode;
	}



	/**
	 * @param sapPlantCode the sapPlantCode to set
	 */
	protected void setSapPlantCode(String sapPlantCode) {
		this.sapPlantCode = sapPlantCode;
	}



	/**
	 * @return the matritalCode
	 */
	protected String getMatritalCode() {
		return matritalCode;
	}



	/**
	 * @param matritalCode the matritalCode to set
	 */
	protected void setMatritalCode(String matritalCode) {
		this.matritalCode = matritalCode;
	}



	/**
	 * @return the customerCode
	 */
	protected String getCustomerCode() {
		return customerCode;
	}



	/**
	 * @param customerCode the customerCode to set
	 */
	protected void setCustomerCode(String customerCode) {
		this.customerCode = customerCode;
	}



	/**
	 * @return the status
	 */
	protected String getStatus() {
		return status;
	}



	/**
	 * @param status the status to set
	 */
	protected void setStatus(String status) {
		this.status = status;
	}



	/**
	 * @return the receipt_status
	 */
	protected String getReceipt_status() {
		return receipt_status;
	}



	/**
	 * @param receipt_status the receipt_status to set
	 */
	protected void setReceipt_status(String receipt_status) {
		this.receipt_status = receipt_status;
	}



	/**
	 * @return the bs_cs_status
	 */
	protected String getBs_cs_status() {
		return bs_cs_status;
	}



	/**
	 * @param bs_cs_status the bs_cs_status to set
	 */
	protected void setBs_cs_status(String bs_cs_status) {
		this.bs_cs_status = bs_cs_status;
	}



	/**
	 * @return the action
	 */
	protected String getAction() {
		return action;
	}



	/**
	 * @param action the action to set
	 */
	protected void setAction(String action) {
		this.action = action;
	}



	/**
	 * @return the syncIsstaging
	 */
	protected String getSyncIsstaging() {
		return syncIsstaging;
	}



	/**
	 * @param syncIsstaging the syncIsstaging to set
	 */
	protected void setSyncIsstaging(String syncIsstaging) {
		this.syncIsstaging = syncIsstaging;
	}



	/**
	 * @return the documentNo
	 */
	protected String getDocumentNo() {
		return documentNo;
	}



	/**
	 * @param documentNo the documentNo to set
	 */
	protected void setDocumentNo(String documentNo) {
		this.documentNo = documentNo;
	}



	/**
	 * @return the contractNo
	 */
	protected String getContractNo() {
		return contractNo;
	}



	/**
	 * @param contractNo the contractNo to set
	 */
	protected void setContractNo(String contractNo) {
		this.contractNo = contractNo;
	}



	/**
	 * @return the bookingOrContarctNo
	 */
	protected String getBookingOrContarctNo() {
		return BookingOrContarctNo;
	}



	/**
	 * @param bookingOrContarctNo the bookingOrContarctNo to set
	 */
	protected void setBookingOrContarctNo(String bookingOrContarctNo) {
		BookingOrContarctNo = bookingOrContarctNo;
	}



	/**
	 * @return the receipteddocumentNo
	 */
	protected String getReceipteddocumentNo() {
		return ReceipteddocumentNo;
	}



	/**
	 * @param receipteddocumentNo the receipteddocumentNo to set
	 */
	protected void setReceipteddocumentNo(String receipteddocumentNo) {
		ReceipteddocumentNo = receipteddocumentNo;
	}



	/**
	 * @return the cN_DocumentNo
	 */
	protected String getCN_DocumentNo() {
		return CN_DocumentNo;
	}



	/**
	 * @param cN_DocumentNo the cN_DocumentNo to set
	 */
	protected void setCN_DocumentNo(String cN_DocumentNo) {
		CN_DocumentNo = cN_DocumentNo;
	}



	/**
	 * @return the contractRefNo
	 */
	protected String getContractRefNo() {
		return contractRefNo;
	}



	/**
	 * @param contractRefNo the contractRefNo to set
	 */
	protected void setContractRefNo(String contractRefNo) {
		this.contractRefNo = contractRefNo;
	}



	/**
	 * @return the processAction
	 */
	protected String getProcessAction() {
		return processAction;
	}



	/**
	 * @param processAction the processAction to set
	 */
	protected void setProcessAction(String processAction) {
		this.processAction = processAction;
	}



	/**
	 * @return the processActionBy
	 */
	protected String getProcessActionBy() {
		return processActionBy;
	}



	/**
	 * @param processActionBy the processActionBy to set
	 */
	protected void setProcessActionBy(String processActionBy) {
		this.processActionBy = processActionBy;
	}



	/**
	 * @return the refType
	 */
	protected String getRefType() {
		return refType;
	}



	/**
	 * @param refType the refType to set
	 */
	protected void setRefType(String refType) {
		this.refType = refType;
	}



	protected Map ConvertParamToHashMap() throws Exception {
		Map mapValue = new HashMap<String, Object>();
		
		try{
	
			mapValue.put("action", action);				
			mapValue.put("syncIsstaging", syncIsstaging);			
			mapValue.put("company", company);			
			mapValue.put("project", project);				
			mapValue.put("buildingPhase", buildingPhase);			
			mapValue.put("zoneCode", zoneCode);			
			mapValue.put("unitNumber", unitNumber);		
			mapValue.put("documentNo", documentNo);
			mapValue.put("refType", refType);
			mapValue.put("matritalCode", matritalCode);
			mapValue.put("sapPlantCode", sapPlantCode);			
			mapValue.put("customerCode", customerCode);			
			mapValue.put("status", status);
			mapValue.put("contractNo", contractNo);
			mapValue.put("BookingOrContarctNo", BookingOrContarctNo);
			mapValue.put("ReceipteddocumentNo", ReceipteddocumentNo);	
			mapValue.put("CN_DocumentNo", CN_DocumentNo);
			mapValue.put("receipt_status", receipt_status);
			mapValue.put("bs_cs_status", bs_cs_status);
			mapValue.put("contractRefNo", contractRefNo);
			mapValue.put("processAction", processAction);
			mapValue.put("processActionBy", processActionBy);
			
			StringBuffer _strQuery = new StringBuffer();
			_strQuery.append("bs_cs_status=" + bs_cs_status).append("||");
			_strQuery.append("receipt_status=" + receipt_status).append("||");
			_strQuery.append("CN_DocumentNo=" + CN_DocumentNo).append("||");
			_strQuery.append("ReceipteddocumentNo=" + ReceipteddocumentNo).append("||");
			_strQuery.append("BookingOrContarctNo=" + BookingOrContarctNo).append("||");
			_strQuery.append("contractNo=" + contractNo).append("||");
			_strQuery.append("status=" + status).append("||");
			_strQuery.append("customerCode=" + customerCode).append("||");
			_strQuery.append("sapPlantCode=" + sapPlantCode).append("||");
			_strQuery.append("matritalCode=" + matritalCode).append("||");
			_strQuery.append("action=" + action).append("||");
			_strQuery.append("syncIsstaging=" + syncIsstaging).append("||");
			_strQuery.append("company=" + company).append("||");
			_strQuery.append("project=" + project).append("||");
			_strQuery.append("buildingPhase=" + buildingPhase).append("||");
			_strQuery.append("zoneCode=" + zoneCode).append("||");
			_strQuery.append("unitNumber=" + unitNumber).append("||");
			_strQuery.append("documentNo=" + documentNo).append("||");
			_strQuery.append("contractRefNo=" + contractRefNo).append("||");
			_strQuery.append("processAction=" + processAction).append("||");
			_strQuery.append("processActionBy=" + processActionBy).append("||");
			_strQuery.append("refType=" + refType);
			System.out.println(_strQuery.toString());
			log.info(_strQuery.toString());
			
			return mapValue;

		}catch(Exception e){
			log.error(e.getMessage());
		}
		return null;
	}
}
